package com.yugao.fintech.draper.demos.configure;

import com.yugao.fintech.draper.sequence.segment.SeqSegmentConfig;
import com.yugao.fintech.draper.sequence.segment.SeqSegmentManager;
import com.yugao.fintech.draper.sequence.service.Sequence;
import com.yugao.fintech.draper.sequence.service.impl.DefaultSegmentSequence;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration(proxyBeanMethods = false)
@RequiredArgsConstructor
public class SeqConfig {

    private final SeqSegmentManager seqSegmentManager;

    @Bean
    public Sequence fxzSequence() {
        // 序列号号段配置
        SeqSegmentConfig seqSegmentConfig = new SeqSegmentConfig().setStep(1).setRangeStart(0L).setRangeStep(10);

        return new DefaultSegmentSequence(seqSegmentManager, seqSegmentConfig);
    }

    @Bean
    public Sequence cloudSequence() {
        // 序列号号段配置
        SeqSegmentConfig seqSegmentConfig = new SeqSegmentConfig().setStep(1).setRangeStart(0L).setRangeStep(1000);
        return new DefaultSegmentSequence(seqSegmentManager, seqSegmentConfig);
    }
}
